Page({
  data: {
    recommendList: [],
    goodsList: [
      {
        img: 'https://images.pexels.com/photos/17022094/pexels-photo-17022094.jpeg?auto=compress&cs=tinysrgb&w=800',
        name: '【“葡萄爱马仕”】现摘阳光下的黑精灵',
        price: '¥75.00',
        oldPrice: '¥98.00',
        deadTime: '今晚23:00'
      },
      {
        img: 'https://images.pexels.com/photos/974229/pexels-photo-974229.jpeg?auto=compress&cs=tinysrgb&w=800',
        name: '【水果镶嵌，颗颗酸甜】携带维C的曲奇',
        price: '¥39.90',
        oldPrice: '¥59.00',
        deadTime: '今晚23:00'
      },
      {
        img: 'https://images.pexels.com/photos/1346347/pexels-photo-1346347.jpeg?auto=compress&cs=tinysrgb&w=800',
        name: '【看得见的绿色】 新鲜榨取蔬菜汁 0防腐',
        price: '¥69.00',
        oldPrice: '¥88.00',
        deadTime: '今晚23:00'
      },
      {
        img: 'https://images.pexels.com/photos/1590042/pexels-photo-1590042.jpeg?auto=compress&cs=tinysrgb&w=800',
        name: '【悬空的自在】Xxb吊床 舒适的感觉源于面向生活的设计',
        price: '¥139.90',
        oldPrice: '¥159.00',
        deadTime: '今晚23:00'
      },
      {
        img: 'https://images.pexels.com/photos/10493902/pexels-photo-10493902.jpeg?auto=compress&cs=tinysrgb&w=800',
        name: '【6件套】相约回忆中的老粗布',
        price: '¥159.90',
        oldPrice: '¥199.00',
        deadTime: '今晚23:00'
      }
    ],
    backTopShow: false
  },
  onLoad() {
    this.getTodayrecommendInfo()
  },
  onPageScroll(ev) {
    if (ev.scrollTop >= 300 && !this.data.backTopShow) {
      this.setData({
        backTopShow: true
      })
    }
    if (ev.scrollTop < 300 && this.data.backTopShow) {
      this.setData({
        backTopShow: false
      })
    }
  },
  async getTodayrecommendInfo() {
    const { message, meta } = await wx.http.get('/api/public/v1/home/floordata')
    if (meta.status !== 200) wx.utils.toast('获取今日推荐信息失败！')
    this.setData({
      recommendList: message
    })
  },
  backTop() {
    wx.pageScrollTo({ scrollTop: 0 })
  }
})